package cn.sunjinxin.trade.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.experimental.FieldDefaults;

import java.util.Arrays;
import java.util.Objects;

/**
 * @author issavior
 */
@AllArgsConstructor
@Getter
@FieldDefaults(makeFinal = true, level = lombok.AccessLevel.PRIVATE)
public enum BizType {

    TICKET("biz.sub.ticket", "门票"),
    ANNUAL_PASS("biz.sub.route", "旅游线"),
    SERVICE("biz.sub.service", "服务"),
    HOTEL("biz.sub.hotel", "酒店"),
    NAVIGATION("biz.sub.navigation", "活动"),
    AGREE("biz.sub.package", "酒套"),

    UNKNOWN("biz.sub.unknown", "其他");

    private final String code;
    private final String msg;

    public static BizType of(String code) {
        return Arrays.stream(BizType.values())
                .filter(e -> Objects.equals(e.getCode(), code))
                .findFirst()
                .orElse(null);
    }
}
